#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
char arr[1005][16];
//int cmp(char a,char b)
//{
//	return strcmp((char*)a,(char*)b);
//}
int main()
{
	int n;
	while (cin >> n)
	{
		if (n == 0) {
			break;
		}
		int brr[1005];
		for (int i = 1; i <= n; i++)
		{
			brr[i]=0;
		}
		for (int i = 1; i <= n; i++)
		{
			cin >> arr[i];
		}
		//sort(arr, arr + n, cmp);
		for (int i = 1; i <= n; i++)
		{
			for (int j = i + 1; j <= n; j++)
			{
				if (strcmp(arr[i],arr[j])==0)
				{
					brr[i]++;
				}
			}
		}
		int k = 1;
		int Max = brr[1];
		for (int i = 1; i <= n; i++)
		{
			if (brr[i] > Max)
			{
				Max = brr[i];
				k = i;
			}
		}
		//printf("%s\n", arr[k]);
		cout << arr[k] << endl;
	}
	return 0;
}